Undocumented Doors functions NLS_ & NLSTMP_

Hello,

 

I've come accross two undocumented functions called NLS_(string s) and NLSTMP_(string s) and I wonder what these fuctions are used for ?

Due to my fairly simple testing I can say that these functions returning the string I gave them. However I don't know what these functions doing with the String other than simply returning it. something like :

//something like
string NLS_(string s)
{
    return s;
}

//or does this functions more than simply returning 
string NLS_(string s)
{
    //processing...
    return s;
}
// same for NLSTMP

I found a very informative post here in the Forum https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014299623 but this post is from 2009 I wonder if something have changed since then.

Furthermore I'm very interested in two Topics from this post.

The first Topic:

"I speculate, and hope others can chime in:

'LS' is apparently 'LocalizedString'.
'Temp' is I presume like tempStringOf(Buffer), string conversion that doesn't eat up string table space.
'N' is perhaps 'Non'.

I guess: this is all an attempt to reduce wasted string table space, where these strings exist only once and the doors string table does NOT grow slowly and steadily over time, the more you use DOORS."

from llandale/ Luie

and the second Topic is:

"

string NLSTEMP_(string s)
string NLS_(string s)

do nothing, but returning the parameter you pass to them. Maybe they have been used to give them a function later, but at the moment they are pretty useless."

from Mathias Mamsch

The question which come to my mind while reading this was, at 2009 these functions seemed to do nothing but is this still the case now at 2018 or more precice at the doors Version I use Version 9.6.1.6?

Unfortunately I don't know how I could test these functions to find other functionalities.

 

Best regards,

Patrick

 


Patrick_1 - Mon Oct 15 04:17:01 EDT 2018

Re: Undocumented Doors functions NLS_ & NLSTMP_
Mike.Scharnow - Mon Oct 15 04:36:25 EDT 2018

Personally, I think that this is a convenience for the programmers of dxl scripts that may be rolled out to the world. And that it is intentional that NLS_ will never return any other value than the string itself.

 

Imagine you have written a program that now shall be localized. You see a lot of strings in your code, and for each of them you have to decide whether the string is to be translated or not.

 

Example

const string doorsHome = getenv ("DOORSHOME") ""
if (null doorsHome) {
    error "Das Basisverzeichnis von DOORS konnte nicht ermittelt werden!"
}

now, you ask your developer 1 to prepare this code for translation. The developer looks for any " and ' in the code

He will see that the error message has to be localized, so he replaces the string with LS_(err_noDOORSHome, "could not find root directory of DOORS")

What about the string "DOORSHOME" or the string ""? It is clear that these strings must never be localized, the variable will be called DOORSHOME in all variants of Windows. and the empty string will always be used to cast a result to string.

So, the developer could choose just to leave the code as is.

Next, developer 2 is asked to check the work of developer 1. He again sees that there is a string which has to be localized and now has to decide whether developer 1 forgot to look at this code or whether nothing is to be done here.

By surrounding the strings "DOORSHOME" and "" by NLS_(..), it is clear to everybody that you have a string here that must never be localized.

 

Regards,
Mike

Re: Undocumented Doors functions NLS_ & NLSTMP_
Mike.Scharnow - Mon Oct 15 04:48:40 EDT 2018

PS: you could even go one step further and change the LS-Line to

LS_(err_noDOORSHome, NLS_("could not find root directory of DOORS"))

This way, you could use a simple lookbehind regex  like

/(?<!N?LS_\s*\()\s*"([\"]*)"/

to determine whether all your code has been localized